<?php include_once 'eventcontroller.php' ?>
<?php include_once 'commentcontroller.php' ?>
<?php include_once 'albumcontroller.php' ?>
<div id="cright">
        <div class="menu-left">
            <h3>Hoạt động gì mới</h3>
            <ul class="post-nav activity">
                <?php foreach($list_tv_cm as $tv){ ?>
                <li>
                    <div>
                        <div style="float: left;">
                            <img class="img-border" src="data/avatar/<?php echo $tv["avatar"] ?>" width="40px" height="40px" alt="<?php echo $tv["avatar"] ?>"/>
                        </div>
                        <div style="float:left;width:150px;word-wrap:break-word;padding-left:3px;">                                        
                            <p>
                                <?php $post = get_baiviet_post_id($tv[1]); ?>
                                <b style="color:#3087ca"><?php echo $tv["username"] ?></b> <i><a style="padding-left: 0px;" href="comment.php?pid=<?php echo $post[0] ?>">comment bài viết của</a></i> <b><?php echo $post[7] ?></b>
                            </p>
                            <br/>
                            <p>
                                <?php $date = date("d/m/Y g:i a",  strtotime("{$tv["date_comment"]}")); ?>
                                <img src="Images/icon/comment.gif" all="comment"/> <?php echo $date ?>
                            </p>
                        </div>
                    </div>
                    <div style="clear: both"></div>
                </li>                             
                <?php } ?>                
            </ul>
            <h3>Tạo sự kiện mới 52PM1</h3>
            <ul>
                <li>
                    <form action="" method="POST" id="event-form">
                        <input type="hidden" name="checksubmit" value="submitsk"/>
                        <input class="borderinput" style="width:230px;" id="tensukien" type="text" name="tensukien" placeholder="Tạo sự kiện..." value=""/>
                        <br/><br/>
                        <input class="borderinput" placeholder="Thời gian..." type="text" id="thoigian" name="ngaylapsukien"  value=""/>
                        <select id="type_event" class="borderinput"  style="width:100px" name="event_type_id">
                            <option value="">- Loại -</option> 
                            <?php foreach($list_type_event as $sk){ ?>
                            <option value="<?php echo $sk["id"] ?>"><?php echo $sk["loaisukien"] ?></option> 
                            <?php } ?>
                        </select>
                        <br/><br/>
                        <input class="borderinput" style="width:230px;" type="text" id="diadiem" name="diadiem" placeholder="Địa điểm..." value=""/><br/><br/>
                        <input class="borderinput" style="width:230px;" type="text" name="noidung" placeholder="Nội dung ngắn gọn..." value=""/><br/><br/>
						<?php if(isset($_COOKIE["username"])){ ?>
                        <a href="#" class="button" onclick="return saveEvent()"><span class="heart icon"></span>Tạo sự kiện</a>
						<?php }else{ ?>
						<a href="register.php" class="button" onclick=""><span class="key icon"></span>Đăng ký hoặc đăng nhập</a>
						<?php } ?>
                    </form>                                
                </li>
                <li><a href="#"></a></li>
            </ul>
            <h3>Ảnh đẹp 52PM1</h3>
            <div id="exp1" class="exmp smallslider" style="border: none;">
                <ul style="position: relative;left: -27px;border:none">
                    <?php if(!empty($list_image_new)){ ?>
                    <?php foreach($list_image_new as $img){ ?>
                    <li><a class="img-border" href="data/album/<?php echo $img["image_name"] ?>"><img class="img-border" width="257px"  src="data/album/<?php echo $img["image_name"] ?>" title="" alt="<?php echo $img["fullname"]  ?>" /></a></li>
                    <?php } ?>                    
                    <?php } ?>
                </ul>
            </div>
            <div style="clear: both"></div>
        </div>
    </div>
    <div style="clear: both"></div>
    <script type="text/javascript">
        function saveEvent(){         
            if($("#tensukien").val() != "" && $("#thoigian").val() != "" && $("#type_event").val() != "" && $("#diadiem").val()){
                $("#event-form").submit();
            }else{
                $("#tensukien").css("background","#FFEDEF");
                $("#thoigian").css("background","#FFEDEF");
                $("#type_event").css("background","#FFEDEF");
                $("#diadiem").css("background","#FFEDEF");
            }        
            return false;
        }
        $(function(){
             $("#thoigian").datetimepicker({
            showSecond: true,
            timeFormat: 'hh:mm:ss'
        });
        })
    </script>
    